package com.youpai.platform.order.service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youpai.platform.biggod.service.entity.po.BigGodPO;
import com.youpai.platform.order.service.entity.po.OrderPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

/**
 * @time: 2022/11/21
 * @author: huanghao
 * @description: 订单mapper
 */
@Repository
public interface OrderMapper{

    //新增订单
    public Integer add(OrderPO orderPO);

    //更新订单
    public Integer update(OrderPO orderPO);

    //更新订单状态
    public Integer updateStatus(
            @Param(value = "orderId") Long orderId,
            @Param(value = "orderStatus") Integer orderStatus);

    //通过订单ID获取订单信息
    public OrderPO get(Long orderId);

    //获取订单列表
    public List<OrderPO> getByUid(
            @Param(value = "boosUId") Long boosUId,
            @Param(value = "godUId") Long godUId,
            @Param(value = "orderStatus") Integer orderStatus,
            @Param(value = "offset") Integer offset,
            @Param(value = "length") Integer length);

    //数据条数
    public Integer countItem(
            @Param(value = "boosUId") Long boosUId,
            @Param(value = "godUId") Long godUId,
            @Param(value = "orderStatus") Integer orderStatus);

    //批量获取未支付订单列表
    public List<OrderPO> getNoPayList(
            @Param(value = "time") Timestamp time,
            @Param(value = "orderStatus") Integer orderStatus);

    //批量关闭订单
    public Integer shutDownOrder(
            @Param(value = "orderIds") List<Long> orderIds,
            @Param(value = "orderStatus") Integer orderStatus);


    //删除订单列表
    public Integer remove(
            @Param(value = "orderIds") List<Long> orderIds);

    //从数据库中物理删除，仅用于测试
    public Integer delete(Long orderId);

}
